﻿namespace LuckyAssetManagerContrib.Configuration
{
	using System.Configuration;

	/// <summary>
	/// Configuration settings of processor, responsible 
	/// for choosing appropriate version of asset file, depending 
	/// on current mode of web application
	/// </summary>
	public sealed class SelectPathProcessorElement : ConfigurationElement
	{
		/// <summary>
		/// Duration of storage appropriate version of asset file 
		/// path in memory cache (in minutes)
		/// </summary>
		[ConfigurationProperty("memoryCacheDurationInMinutes", DefaultValue = 15)]
		[IntegerValidator(MinValue = 1, MaxValue = 1440, ExcludeRange = false)]
		public int MemoryCacheDurationInMinutes
		{
			get { return (int)this["memoryCacheDurationInMinutes"]; }
			set { this["memoryCacheDurationInMinutes"] = value; }
		}

		/// <summary>
		/// Enables sliding expiration time of memory cache
		/// </summary>
		[ConfigurationProperty("useMemoryCacheSlidingExpiration", DefaultValue = false)]
		public bool UseMemoryCacheSlidingExpiration
		{
			get { return (bool)this["useMemoryCacheSlidingExpiration"]; }
			set { this["useMemoryCacheSlidingExpiration"] = value; }
		}
	}
}
